package com.qfedu.openplateform.manager.service.impl;

/**
 * TODO
 *
 * @author DELL
 * @date 2021-10-27 21:44
 */

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qfedu.openplateform.manager.controller.RechargeController;
import com.qfedu.openplateform.manager.dao.RechargeMapper;
import com.qfedu.openplateform.manager.entity.Recharge;
import com.qfedu.openplateform.manager.service.RechargeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RechargeServiceImpl implements RechargeService {


    @Resource
    private RechargeMapper rechargeMapper;


    @Override
    public PageInfo<Recharge> getRecharge(Recharge recharge, Integer page, Integer limit) {

        PageHelper.startPage(page, limit);
        return new PageInfo<>(rechargeMapper.getRecharge(recharge));
    }

    @Override
    public void deleteRechargeById(int id) {
        rechargeMapper.deleteRechargeById(id);
    }

    @Override
    public void addRecharge(Recharge recharge) {
        rechargeMapper.addRecharge(recharge);
    }

    @Override
    public void updateRecharge(Recharge recharge) {
        rechargeMapper.updateRecharge(recharge);
    }

    @Override
    public List<Recharge> getRechargeTree() {
        List<Recharge> allRecharge = rechargeMapper.getAllRecharge();
        return allRecharge;
    }
}
